"""
Task 2

Extend Phonebook application

Functionality of Phonebook application:

    Add new entries
    Search by first name
    Search by last name
    Search by full name
    Search by telephone number
    Search by city or state
    Delete a record for a given telephone number
    Update a record for a given telephone number
    An option to exit the program



The first argument to the application should be the name of the phonebook. Application should load JSON data, if it is
present in the folder with application, else raise an error. After the user exits, all data should be saved
to loaded JSON
"""

import json


def create_contact_dict(first_name, last_name, phone_number, city):
    contact_dict = {
        "firstname:": first_name,
        "lastname": last_name,
        "phone_number": phone_number,
        "city": city

    }
    return contact_dict


empty_contact = create_contact_dict("", "", "", "")

phonebook_name = input("Enter phonebook name: ")
with open(phonebook_name + ".json", "w") as phonebook:
    json.dump(empty_contact, phonebook)
